# -*- coding: utf-8 -*-
from objectvalue.dataOV import dataOV

# API返回数据中属性为int的字段
NUMBER_FIELD=['gid','posted','filecount','filesize','rating','torrentcount']

def datadump(json):
    OVlist = []
    for data in json['gmetadata']:
        OVlist.append(dataOV(gid = data['gid'], token = data['token'], archiver_key = data['archiver_key'], title = data['title'],
                             category = data['category'], thumb = data['thumb'], uploader = data['uploader'], posted = data['posted'],
                             filecount = data['filecount'], filesize = data['filesize'], expunged = data['expunged'],
                             rating = data['rating'], torrentcount = data['torrentcount'], tags = data['tags']))
    return OVlist

if __name__ == "__main__":
    data = {'gmetadata': [{'gid': 1020596, 'token': '149318d694', 'archiver_key': '412743--281680f998e108352fb8a5bcf032cb485dce09cb', 'title': '[Gensou Stomach (Taku)] Oppatchouli Ijime (Touhou Project) [Digital]', 'title_jpn': '[幻想ストマック (タク)] おっぱちゅりーいじめ (東方Project) [DL版]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/24/15/24157526bffb11a4dcf7e43f2e4f265b1cccd812-120649-1050-1447-jpg_l.jpg', 'uploader': 'nomorenamesleft', 'posted': '1484979795', 'filecount': '22', 'filesize': 3071397, 'expunged': False, 'rating': '4.37', 'torrentcount': '1', 'tags': ['reclass:doujinshi', 'parody:touhou project', 'character:patchouli knowledge', 'group:gensou stomach', 'artist:taku', 'female:big breasts', 'female:paizuri', 'female:huge breasts']}, {'gid': 1020597, 'token': 'd1129a2aa3', 'archiver_key': '412743--48650077d0c33952d9cf97071329868a0debf56c', 'title': '(FF28) [Nyanyahouse (Nyanyakun)] El’s Tentacles Continuation (ELSWORD) [English] {Hennojin}', 'title_jpn': '(FF28) [喵喵屋 (喵喵君)] 艾爾の觸續 (エルソード) [英訳]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/2d/9e/2d9e182372a05dd3fecf289f85f2501b03f1fce7-537707-777-1080-jpg_l.jpg', 'uploader': 'chung2795', 'posted': '1484982886', 'filecount': '19', 'filesize': 7254854, 'expunged': False, 'rating': '4.07', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'parody:elsword', 'character:eve', 'group:nyanyahouse', 'artist:nyanyakun', 'female:lolicon', 'female:tentacles', 'female:sole female', 'female:mind break', 'female:rape', 'female:inflation']}, {'gid': 1020598, 'token': 'f890d6c434', 'archiver_key': '412743--c0403104bcf6373787b90d73e761271f77de497c', 'title': '[Rasahan] Kareshi Shikkaku? | Incapable Boyfriend? (Girls forM Vol. 14) [English] {Hennojin}', 'title_jpn': '[ラサハン] 彼氏失格? (ガールズフォーム Vol.14) [英訳]', 'category': 'Manga', 'thumb': 'https://ehgt.org/9a/d4/9ad44cd459d2f0b56c77ea6e5148b500fc0948d3-1664792-2026-3057-jpg_l.jpg', 'uploader': 'chung2795', 'posted': '1484982946', 'filecount': '25', 'filesize': 39430094, 'expunged': False, 'rating': '4.43', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'artist:rasahan', 'male:sole male', 'male:schoolboy uniform', 'male:cheating', 'male:prostate massage', 'female:garter belt', 'female:footjob', 'female:stockings', 'female:femdom', 'female:lingerie', 'female:rimjob', 'female:schoolgirl uniform', 'ffm threesome', 'group', 'mosaic censorship']}, {'gid': 1020599, 'token': '533a889f92', 'archiver_key': '412743--fa68c8572e1752b88553eb64e1c9c1f71263096f', 'title': '(Reitaisai 13) [Lapiz Lazuli Kouseki (Kuroha Rapid)] Jigoku no Megami no Aiganbaku (Touhou Project) [English] {Hennojin}', 'title_jpn': '(例大祭13) [ラピスラズリ鉱石 (黒羽ラピッド)] 地獄の女神の愛玩獏 (東方Project) [英訳]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/4a/53/4a53bf1f0a4ece2fd562a7a56050de1021fec1de-1309522-1424-2000-jpg_l.jpg', 'uploader': 'chung2795', 'posted': '1484983063', 'filecount': '35', 'filesize': 35563519, 'expunged': False, 'rating': '4.54', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'parody:touhou project', 'character:doremy sweet', 'character:hecatia lapislazuli', 'group:lapiz lazuli kouseki', 'artist:kuroha rapid', 'female:futanari', 'female:bondage', 'female:group', 'female:corruption', 'female:ahegao', 'female:dick growth', 'female:mind break', 'female:fft threesome', 'female:piercing', 'female:spanking', 'female:catgirl', 'female:cowgirl', 'female:crotch tattoo']}, {'gid': 1020600, 'token': '6eb095ac5d', 'archiver_key': '412743--c2b34f61e0401c966c1e33ca1da44f36fcf345fb', 'title': 'Dracopedia The Bestiary', 'title_jpn': '', 'category': 'Misc', 'thumb': 'https://ehgt.org/2b/d2/2bd25969ce01c4ac97ba4bcaabb171ac0d6f075c-465839-782-1108-jpg_l.jpg', 'uploader': 'Rankas', 'posted': '1484985029', 'filecount': '315', 'filesize': 49975894, 'expunged': False, 'rating': '4.53', 'torrentcount': '1', 'tags': ['language:english', 'artbook', 'how to']}, {'gid': 1020601, 'token': '5f9865a41b', 'archiver_key': '412743--6dc9cfd42cf26d7ee3667d5322acb8299a5abab9', 'title': '[P:P (Oryou)] Classmate no Onnanoko kara Jidori Shashin Mitai nano ga Okurarete Kitanda kedo… | A Female Classmate Sent Her Selfie to Me… [English] {Hennojin} [Digital]', 'title_jpn': '[P:P (おりょう)] クラスメイトの女の子から自撮り写真みたいなのが送られてきたんだけど... [英訳] [DL版]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/3a/a1/3aa1ca9590ed6913fc23aaae40c2249575044d5f-1343495-2195-3107-jpg_l.jpg', 'uploader': 'chung2795', 'posted': '1484982783', 'filecount': '27', 'filesize': 106377646, 'expunged': False, 'rating': '4.65', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'group:p.p', 'artist:oryou', 'male:sole male', 'female:sole female', 'female:stockings', 'female:catgirl', 'female:blackmail']}, {'gid': 1020602, 'token': '3046e11a1f', 'archiver_key': '412743--87383f8c25164e30cf7ab3b1764bfc9cafa862b8', 'title': '[Michiking] Ane Taiken Ganbou | The Desire For The Older Sister Experience (COMIC Anthurium 2017-02) [English] =TLL + CW= [Digital]', 'title_jpn': '[みちきんぐ] 姉体験願望 (COMIC アンスリウム 2017年2月号) [英訳] [DL版]', 'category': 'Manga', 'thumb': 'https://ehgt.org/83/28/832865916fc0e25735a0a4973f8d4d102085726d-2131894-2090-3000-jpg_l.jpg', 'uploader': 'mrwayne', 'posted': '1484981095', 'filecount': '5', 'filesize': 10355616, 'expunged': False, 'rating': '4.51', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'artist:michiking', 'male:shotacon', 'male:sole male', 'female:sister', 'female:sole female', 'female:big breasts', 'female:x-ray', 'full color', 'incest']}, {'gid': 1020603, 'token': '1f696b2626', 'archiver_key': '412743--99a198f49557580f43ff0f7e27eb1dcb97e6b0a4', 'title': '[Hong BanJang] Aharoo Ch.1-44 (English) (YoManga) (Ongoing)', 'title_jpn': '', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/99/15/991523f8cab38ce36e3cca14cb40f0141193a4f4-549528-1280-720-jpg_l.jpg', 'uploader': 'Viktor0nk', 'posted': '1484981218', 'filecount': '864', 'filesize': 1116000050, 'expunged': False, 'rating': '4.36', 'torrentcount': '4', 'tags': ['language:english', 'language:translated', 'artist:hong banjang', 'male:bondage', 'female:slave', 'female:blood', 'female:snuff', 'female:big breasts', 'female:rape', 'female:bondage', 'female:chloroform', 'female:full body tattoo', 'full color', 'webtoon', 'full censorship', 'scanmark']}, {'gid': 1020609, 'token': '7df75786ee', 'archiver_key': '412743--b89dc93f2d46beab7e1d5d889a41c4cae0bffd7b', 'title': '(C91) [Funi Funi Lab (Tamagoro)] NKDC Vol. 5 (Pokémon) [Chinese] [final個人漢化] [Decensored]', 'title_jpn': '(C91) [フニフニラボ (たまごろー)] NKDC Vol.5 (ポケットモンスター) [中国翻訳] [無修正]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/3a/66/3a667b08f6ff7e9e4353982c64c529c699fc2f72-1131320-1275-1800-jpg_l.jpg', 'uploader': 'sanjogahara', 'posted': '1484983969', 'filecount': '9', 'filesize': 7643398, 'expunged': False, 'rating': '4.73', 'torrentcount': '1', 'tags': ['language:chinese', 'language:translated', 'parody:pokemon', 'character:mallow', 'character:sun', 'group:funi funi lab', 'artist:tamagoro', 'male:sole male', 'female:dark skin', 'female:sole female', 'female:nakadashi', 'uncensored']}, {'gid': 1020610, 'token': '957fe008d6', 'archiver_key': '412743--090187da43add8e602128474609b8f5bc2737c2f', 'title': 'Artist - Machete01', 'title_jpn': '', 'category': 'Western', 'thumb': 'https://ehgt.org/96/13/96135637408978463b3fc709b37e69b8edc80a5e-339110-2738-3090-jpg_l.jpg', 'uploader': 'ToasterTim', 'posted': '1484984954', 'filecount': '52', 'filesize': 34923929, 'expunged': False, 'rating': '4.54', 'torrentcount': '1', 'tags': ['language:english', 'artist:machete01', 'female:toddlercon', 'female:lolicon', 'female:anal', 'female:blowjob', 'female:urination']}, {'gid': 1020611, 'token': '2dea1d8517', 'archiver_key': '412743--3ed22bbeb9f5cfc82a155e7a1544df44e8c61dd5', 'title': '(C89) [Forest Village (Ayukko)] Sei Ippai Producers! 3 (THE IDOLM@STER CINDERELLA GIRLS) [English] [L-san Scans]', 'title_jpn': '(C89) [Forest Village (あゆっこ)] せいいっぱいプロデュース!3 (アイドルマスター シンデレラガールズ) [英訳]', 'category': 'Non-H', 'thumb': 'https://ehgt.org/d2/9f/d29fcd0002bb9545d567df15f61aa841b4f0ffd2-2110977-966-1400-png_l.jpg', 'uploader': 'RaymooHakure', 'posted': '1484985198', 'filecount': '28', 'filesize': 12503274, 'expunged': False, 'rating': '4.36', 'torrentcount': '1', 'tags': ['language:english', 'language:translated', 'parody:the idolmaster', 'character:producer', 'group:forest village', 'artist:ayukko', 'male:business suit']}, {'gid': 1020612, 'token': '31a75cce4a', 'archiver_key': '412743--e84be6acb3d81d5f0816b4ec2ec1ef11ac0b56fe', 'title': 'Dracopedia', 'title_jpn': '', 'category': 'Misc', 'thumb': 'https://ehgt.org/76/de/76de4c9bf1df6522e36f5cd2d66794caf4ac49b9-219610-851-1113-jpg_l.jpg', 'uploader': 'Rankas', 'posted': '1484985484', 'filecount': '165', 'filesize': 33753108, 'expunged': False, 'rating': '4.71', 'torrentcount': '1', 'tags': ['language:english', 'artbook', 'how to']}, {'gid': 1020613, 'token': 'c4e73ed2ce', 'archiver_key': '412743--71745ae1b071eb35a177d9185d856b1f2a2e60a0', 'title': '[Barikan Shoujo] Clipper Girls 4', 'title_jpn': '[バリカン少女] バリカン少女4', 'category': 'Non-H', 'thumb': 'https://ehgt.org/86/23/86231c7869cb405f8c4e1582f05e09745983b1ee-4489289-1920-2800-jpg_l.jpg', 'uploader': 'surusuruonna', 'posted': '1484985632', 'filecount': '9', 'filesize': 39246365, 'expunged': False, 'rating': '3.10', 'torrentcount': '0', 'tags': ['language:english', 'language:translated', 'female:females only', 'female:humiliation']}, {'gid': 1020617, 'token': '2d4efd6e91', 'archiver_key': '412743--1e4551513e1bf357070cd107b580b5303b29b9ac', 'title': '(Utahime Teien 2) [PLANT (Tsurui)] AZ memories (THE iDOLM@STER) [Korean] [시뮬라시옹]', 'title_jpn': '(歌姫庭園2) [PLANT (鶴井)] AZ memories (アイドルマスター) [韓国翻訳]', 'category': 'Doujinshi', 'thumb': 'https://ehgt.org/a6/ba/a6ba3cb610e77b5630103cefabd5b9c183da8cdd-1631176-1390-2000-jpg_l.jpg', 'uploader': 'gjfkal', 'posted': '1484986038', 'filecount': '37', 'filesize': 62354752, 'expunged': False, 'rating': '4.61', 'torrentcount': '1', 'tags': ['language:korean', 'language:translated', 'parody:the idolmaster', 'character:azusa miura', 'group:plant', 'artist:tsurui', 'male:sole male', 'female:pantyhose', 'female:glasses', 'female:schoolgirl uniform', 'female:sole female']}]}
    list = datadump(data)
    for a in list:
        print(a)
